home *** CD-ROM | disk | FTP | other *** search
/ Fifty: Elektronik / FIFTY Elektronik (PS_Computer_Vertrieb).iso / ps8 / fty1017 / gepackt.exe / DISK2 / PLOTSRC.EXE / EINSTELL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-11-10  |  13.0 KB  |  463 lines

  1. {$O+,R-,S-,B-,I+,F+}
  2. Unit Einstell;
  3.  
  4. Interface
  5.  
  6. uses
  7.   Crt,
  8.   Dos,
  9.   StrTool,
  10.   GEDDEFS,
  11.   KEYSCRN,
  12.   PLOTSYS,
  13.   PLOTSTOR,
  14.   PLSteuer,
  15.   PLGLOB;
  16.  
  17. Procedure ShowLayers(NFound :Integer);
  18.  
  19. Procedure Formate;
  20.  
  21. Procedure SetStiftBreite;
  22.  
  23. implementation
  24.  
  25. (*$V-*)
  26.  
  27.  
  28. Procedure ShowLayers(NFound :Integer);
  29. Const MaxDir=10;
  30.  
  31. var
  32.   Taste,TC      : Char;
  33.   KeyFunc    :Integer;
  34.   first,Last,OldFirst,
  35.   FlipPos,OldFlip:Integer;
  36.   S:Str80;
  37.  
  38.  
  39.   Procedure ShowDir(First,Last:Integer);
  40.   Var I,K,Ref:Integer;
  41.       Layer_Frozen:Boolean;
  42.       Farbe     :Byte;
  43.  
  44.   begin
  45.     MakeFrame(wind_dir,ModeWinCol,1);
  46.     WritetoWindow(Wind_Dir,15,1,ModeHeadCol,' Ebenen-Einstellung ');
  47.     WriteToWindow(wind_dir,8,MaxDir+2,ModeHeadCol,
  48.         ' <Ret>: ein/aus  <Pg-Dn>:Ändern  <ESC>: Ende ');
  49.     FillChar(S,Sizeof(S),32);
  50.     S[0]:=#56;
  51.     For I:=1 to MaxDir do
  52.       WritetoWindow(Wind_dir,2,1+I,ModeNorCol,S);
  53.     For K:=First to Last  do
  54.      begin
  55.          Layer_Frozen:=Not(LayerNr(K) in PlotLayers);
  56.          If Layer_Frozen then Farbe:=ModeNorCol else Farbe:=ModeLowCol;
  57.          I:=K-First+1;
  58.          WritetoWindow(Wind_dir,2,I+1,Farbe,'Ebene '+GetLayer(LayerNr(K)));
  59.          WritetoWindow(Wind_dir,12,I+1,Farbe,':');
  60.          If Layer_Frozen then
  61.            WritetoWindow(Wind_dir,15,I+1,Farbe,'ausgeblendet')
  62.          else
  63.            WritetoWindow(Wind_dir,15,I+1,Farbe,'eingeblendet');
  64.          WritetoWindow(Wind_dir,35,I+1,Farbe,'Stiftnummer  : ');
  65.          Str(PenLookup[K],S);
  66.          WritetoWindow(Wind_dir,50,I+1,Farbe,S);
  67.      end;
  68.      If Nfound<1 then
  69.        WritetoWindow(Wind_dir,18,5,ModeLowCol,'Keine Einträge gefunden');
  70.     FlushKbd;
  71.   end;
  72.  
  73.   Procedure FlipDir(P:Integer;Color:Byte);
  74.   Var X,Y :Integer;
  75.   begin
  76.     X:=wind_dir.x1+1;
  77.     Y:=Wind_dir.Y1+1+P-First;
  78.     FlipLine(X,Y,Color,56);
  79.   end;
  80.  
  81. Procedure EditLayer(Var L :Integer);
  82.  
  83. Const  SubWinCol  :Byte =Crt.Blue+16 * Crt.LightGray;
  84.        SubHeadCol :Byte =Crt.Black+16* Crt.LightGray;
  85. Var    Sel :Byte;
  86.        Sub_Win      : WindowType;
  87.        TC:Char;
  88.        S:Str15;
  89.        K:Integer;
  90.  
  91.  
  92. Begin
  93.   SaveCrtWindow;
  94.   SaveColors;
  95.   If Not Modeco80 then
  96.     begin
  97.        SubWinCol:=Crt.LightGray*16;
  98.        SubHeadCol:=Crt.White;
  99.     end;
  100.   MakeWindow(Sub_win,Wind_dir.X1+5,Wind_dir.Y1+5,35,3,SubWinCol,wok);
  101.   With Sub_win do
  102.     Window(X1+1,Y1+1,X1+width-2,Y1+height-1);
  103.   MakeFrame(Sub_win,SubWinCol,1);
  104.   WriteToWindow(sub_win,3,1,SubHeadCol,' Ändern Ebene '+GetLayer(LayerNr(L))+' ');
  105.   Str(PenLookup[L],S);
  106.   WriteToWindow(sub_win,3,2,SubWinCol,'Stiftnummer  : '+S);
  107.   PutWindow(Sub_win,wok);
  108.   SetEditColors(blue,Lightgray,Crt.White,blue);
  109.   With SetupInfo.PinstInfo Do
  110.   PenLookup[L]:=LeseInt(PenLookup[L],1,17,1,PenMin,PenMax,TC);
  111.   RestoreWindow(Sub_Win,wok);
  112.   DeleteWindow(Sub_win);
  113.   RestoreColors;
  114.   RestoreCrtWindow;
  115. End;
  116.  
  117. Procedure Show;
  118. begin
  119.   Showdir(First,Last);
  120.   ShowWindow(Wind_dir);
  121.   FlipDir(FlipPos,ModeFlpCol);
  122. end;
  123.  
  124. BEGIN
  125.   ActualHelp:=90;
  126.   MakeWindow (wind_dir,11,8,58,MaxDir+2,ModeWinCol,wok);
  127.   TC:=#0;
  128.   First:=1;
  129.   Last:=Nfound;
  130.   If Last>MaxDir Then Last:=MaxDir;
  131.   FlipPos:=1;
  132.   Showdir(First,Last);
  133.   PutWindow (wind_dir,wok);                { Menü anzeigen }
  134.   If Nfound >0 Then FlipDir(FlipPos,ModeFlpCol);
  135.   IF wok<>0 THEN EXIT;
  136.   Repeat
  137.     KeyFunc:=ReadKbd(Taste);
  138.     If Nfound>0 then
  139.       begin
  140.         Taste:=Upcase(Taste);
  141.         OldFlip:=FlipPos;
  142.         OldFirst:=First;
  143.         If Taste<>#0 then
  144.           Case Taste of
  145.           '1'..'8',
  146.           'A'..'X':
  147.               FlipPos:=EbenenIndex(GetEbene(Taste));
  148.            ^E :FlipPos:=FlipPos-1;(*Pfeil rauf  *)
  149.            ^X :FlipPos:=FlipPos+1;(*Pfeil runter*)
  150.            ^F :Flippos:=NFound;     { Ende }
  151.            ^A :FlipPos:=1;          { Anfang }
  152.            ^Q :begin
  153.                  EditLayer(FlipPos);
  154.                  Show;
  155.                  Inc(FlipPos,1);
  156.                 End;
  157.            ^M :begin
  158.                  If LayerNr(FlipPos) in PlotLayers then
  159.                    PlotLayers:=PlotLayers-[LayerNr(FlipPos)]
  160.                  else
  161.                    PlotLayers:=PlotLayers+[LayerNr(FlipPos)];
  162.                  Show;
  163.                  Inc(FlipPos,1);
  164.                 end;
  165.           end;
  166.         If OldFlip<>FlipPos Then
  167.         begin
  168.           If FlipPos<1 then FlipPos:=1;
  169.           If FlipPos>Nfound Then FlipPos:=Nfound;
  170.           If (FlipPos<First) then First:=Flippos;
  171.           If (Flippos>Last) then
  172.             If Flippos=Nfound then First:=Nfound-Maxdir+1
  173.             else
  174.              If FlipPos>Last+1 then First:=First+(Maxdir*2 div 3)
  175.               else First:=First+1;
  176.           If First>Nfound-Maxdir+1 Then
  177.             First:=Nfound-MaxDir+1;
  178.           If First<1 Then First:=1;
  179.           Last:=First+MaxDir-1;
  180.           If Last>Nfound then Last:=Nfound;
  181.           Limit(Flippos,First,Last);
  182.           If OldFirst<>First Then Show
  183.           else
  184.             begin
  185.               If LayerNr(OldFlip) in PlotLayers then
  186.                  FlipDir(OldFlip,ModeLowCol)
  187.               else
  188.                  FlipDir(OldFlip,ModeNorCol);
  189.               FlipDir(FlipPos,ModeFlpCol);
  190.            end;
  191.         end;
  192.       end;
  193.     UNTIL Taste in [Esc,^Z];
  194.   RestoreWindow (wind_dir,wok);                   { Hintergrund anzeigen }
  195.   DeleteWindow(Wind_dir);
  196. END;
  197.  
  198. Type BooleanRep =Array[Boolean] of Str10;
  199. Const JaNein :BooleanRep =('N','J');
  200.  
  201.  
  202. Procedure LeseBoolean(Var B:Boolean;X,Y:Integer;Var TC:Char);
  203. Var S:String[10];
  204. begin
  205.   S:=Janein[B];
  206.   InputKbd(S,1,X,Y,Term,['J','j','n','N'],TC);
  207.   S:=UpcaseStr(S);
  208.   B:=S='J';
  209. end;
  210.  
  211. Function CtrlSEQ_to_String(Var Ctrl :Str64):Str64;
  212. Var S1 :Str64;
  213.     Num:Str10;
  214.     I,C:Integer;
  215. begin
  216.   S1:='';
  217.   For I:=1 to Length(Ctrl) do
  218.   begin
  219.     C:=Ord(Ctrl[I]);
  220.     If C<32 then
  221.       begin
  222.         Str(C,Num);
  223.         While Not(Num[1] in ['0'..'9']) Do Delete(Num,1,1);
  224.         S1:=S1+'{'+Num+'}'
  225.       end
  226.       else S1:=S1+Ctrl[I];
  227.    end;
  228.    CtrlSEQ_to_String:=S1;
  229.  end;
  230.  
  231. Function ConvertCtrlSeq(Var S:Str64):Boolean;
  232. Var Sout :Str64;
  233.     I,L:Integer;
  234.     Snum :Str10;
  235.     Sonderzeichen,Error :Integer;
  236.     Ok,ParseChar  :Boolean;
  237. begin
  238.   L:=Length(S);
  239.   I:=1;
  240.   Ok:=true;
  241.   ParseChar:=true;
  242.   Sout:='';
  243.   While (I<=L) and ok Do
  244.   begin
  245.     If ParseChar then
  246.        begin
  247.          If S[I]='{' then begin ParseChar:=false; Snum:=''; end
  248.          else
  249.          begin
  250.            OK:=S[I]<>'}';
  251.            If OK then Sout:=Sout+S[I];
  252.          end;
  253.        end
  254.      else
  255.        begin
  256.          If S[I]='}' then
  257.            begin
  258.              ParseChar:=true;
  259.              OK:=(Length(Snum)<>0) and (Length(Snum)<4);
  260.              If Ok then
  261.              begin
  262.                Val(Snum,Sonderzeichen,Error);
  263.                Ok:=(Sonderzeichen<256) and (Error=0);
  264.                If Ok then Sout:=Sout+Chr(Sonderzeichen);
  265.              end;
  266.            end
  267.           else
  268.            begin
  269.              OK:=S[I] in ['0'..'9'];
  270.              If OK then Snum:=Snum+S[I];
  271.            end;
  272.        end;
  273.      I:=Succ(I);
  274.   end;
  275.   If Not(OK) then Delete(S,I-1,L-I+2)
  276.   else S:=Sout;
  277.   ConvertCtrlSeq:=OK;
  278. end;
  279.  
  280. Procedure InputCtrlSeq(Var S:Str64;L,X,Y:Integer; Var TC :Char);
  281. Var TempStr,Si :Str64;
  282.     OK:Boolean;
  283.     Li :Integer;
  284. begin
  285.   Li:=(5 * L) div 2;
  286.   If Li>60 then Li:=60;
  287.   Si:=CtrlSEQ_to_String(S);
  288.   Repeat
  289.     InputKbd(Si,Li,X,Y,Term,[#32..#255],TC);
  290.     tempStr:=Si;
  291.     OK:=ConvertCtrlSeq(TempStr);
  292.     If Not(Ok) then begin beep;Si:=TempStr;end;
  293.   Until OK or (TC=Esc);
  294.   While Length(Tempstr)>L do Delete(Tempstr,Length(TempStr),1);
  295.   If TC<>Esc then S:=TempStr;
  296. end;
  297.  
  298.  
  299. Procedure Formate;
  300. Var TC  :Char;
  301.     L   :Integer;
  302.  
  303.  
  304. Procedure ClearForm;
  305. Var L : Integer;
  306. Begin
  307.   ClrScr;
  308.   LowVideo;
  309.   HeadLine('Plotformat-Einstellungen');
  310.   Line25;
  311.   GotoXY(1,2);Write('DATEI : ');
  312.   Normvideo;Write(FileSetup.DWG);
  313.   Lowvideo;
  314.   GotoXY(45,2);Write('Name des Formats : ');
  315.   Normvideo;
  316.   If Actualparname='' then Write('--') else Write(ActualparName);
  317.   LowVideo;
  318.   GotoXY(45,3);Write('Druck-Modus      : ',PlotModeREP[PlotModus]);
  319.   If PlotModus=Loetstop then
  320.     begin
  321.       GotoXY(45,4);
  322.       Write('Zugabe           : ',LoetstopPlus:3:1);
  323.     end;
  324.   LowVideo;
  325.   GotoXY(1,5);Write('Einheit (fix):           mm');
  326.   GotoXY(1,6);Write('Maßstab     =');
  327.   GotoXY(1,7);Write('Ursprung : X=                 Y=');
  328.   GotoXY(1,8);Write('Schriftdicke  (in % der Höhe)  :');
  329.   GotoXY(1,9);Write('Linienanpassung (rund)         :');
  330.   GotoXY(1,10);Write('Linienteilung gestrichelt      :        (1..25 mm)');
  331.   GotoXY(1,11);Write('Linienteilung strichpunktiert  :        (1..25 mm)');
  332.   GotoXY(1,13);Write('Offset   : X=                 Y=');
  333.   GotoXY(1,14);Write('Fenster  :X1=                Y1=');
  334.   GotoXY(1,15);Write('Fenster  :X2=                Y2=');
  335.   GotoXY(1,16);
  336.   With SetUpInfo.SetupPlotter Do
  337.     Write('maximal  :X = ',MinFormX,'..',FormX,
  338.                       ' mm   Y = ',MinformY,'..',FormY,' mm');
  339.   GotoXY(1,18);Write('Seitenverkehrt drucken (J/N) ?');
  340.   GotoXY(1,19);Write('Im Hoch-Format drucken (J/N) ?');
  341.   GotoXY(1,20);Write('Auf Datei ausgeben     (J/N) ?');
  342.   GotoXY(1,21);
  343.   With SetUpInfo.PinstInfo Do
  344.     Write('Plot-Geschwindigkeit (',Speedmin,'..',SpeedMax,'mm/sec) :');
  345.   GotoXY(1,22);Write('INIT-Sequenz :');
  346.   GotoXY(1,23);Write('EXIT-Sequenz :');
  347.   Normvideo;
  348. End;
  349.  
  350. Procedure WriteForm;
  351. Var K : Integer;
  352. Begin
  353.   With SetupInfo.Voreinstellung,SetUpInfo.PinstInfo Do
  354.   Begin
  355.     RealStr(Einheit,9,OutString);
  356.     GotoXY(15,5);Lowvideo;Write(OutString);NormVideo;
  357.     RealStr(PlotScale,6,OutString);
  358.     GotoXY(15,6);Write(OutString);
  359.     RealStr(Ursprung.X*Einheit,9,OutString);
  360.     GotoXY(15,7);Write(OutString);
  361.     RealStr(Ursprung.Y*Einheit,9,OutString);
  362.     GotoXY(34,7);Write(OutString);
  363.     RealStr(Schriftdicke*100,6,OutString);
  364.     GotoXY(34,8);Write(OutString);
  365.     GotoXY(34,9);Write(JaNein[AdaptLines]);
  366.     RealStr(Lscaledashed,5,OutString);
  367.     GotoXY(34,10);Write(OutString);
  368.     RealStr(Lscaledotted,5,OutString);
  369.     GotoXY(34,11);Write(OutString);
  370.     GotoXY(15,13);Write(PlotOffset.X);
  371.     GotoXY(34,13);Write(PlotOffset.Y);
  372.     GotoXY(15,14);Write(FensterX1);
  373.     GotoXY(34,14);Write(FensterY1);
  374.     GotoXY(15,15);Write(FensterX2);
  375.     GotoXY(34,15);Write(FensterY2);
  376.     GotoXY(32,18);Write(JaNein[Spiegeln]);
  377.     GotoXY(32,19);Write(JaNein[Portrait]);
  378.     GotoXY(32,20);Write(Janein[Aufdatei]);
  379.     With SetUpInfo.PinstInfo Do
  380.     begin
  381.       GotoXY(40,21);
  382.       Write(PlotSpeed);
  383.     end;
  384.     GotoXY(15,22);Write(CtrlSeq_to_String(DeviceInit));
  385.     GotoXY(15,23);Write(CtrlSeq_to_String(DeviceExit));
  386.   End;
  387. End;
  388.  
  389. Procedure Mainform;
  390. begin
  391.   L:=1;
  392.   With SetupInfo.Voreinstellung,SetupInfo.PinstInfo,SetupInfo.SetUpPlotter Do
  393.   Begin
  394.    Repeat
  395.     Case L of
  396.       1 : PlotScale:=LeseReal(PlotScale,6,15,6,0.01,100.0,TC);
  397.       2 : Ursprung.X:=RasterMass(LeseReal(Istmass(Ursprung.X),9,
  398.                                  15,7,0.0,Einheit*EdMaxXY*0.9,TC));
  399.       3 : Ursprung.Y:=RasterMass(LeseReal(Istmass(Ursprung.Y),9,
  400.                                  34,7,0.0,Einheit*EdMaxXY*0.9,TC));
  401.       4 : Schriftdicke:=0.01*LeseReal(Schriftdicke*100,6,34,8,0.0,20,TC);
  402.       5 : LeseBoolean(Adaptlines,34,9,TC);
  403.       6: Lscaledashed:=LeseReal(Lscaledashed,5,34,10,
  404.                                 LineScaleMin,LinescaleMax,TC);
  405.       7: Lscaledotted:=LeseReal(Lscaledotted,5,34,11,
  406.                                 LineScaleMin,LinescaleMax,TC);
  407.       8 : Plotoffset.X:=LeseInt(PlotOffset.X,4,15,13,MinFormX,FormX,TC);
  408.       9 : Plotoffset.Y:=LeseInt(PlotOffset.Y,4,34,13,MinFormY,FormY,TC);
  409.      10 : FensterX1:=LeseInt(FensterX1,4,15,14,MinFormX,FormX,TC);
  410.      11 : FensterY1:=LeseInt(FensterY1,4,34,14,MinFormY,FormY,TC);
  411.      12 : FensterX2:=LeseInt(FensterX2,4,15,15,MinFormX,FormX,TC);
  412.      13 : FensterY2:=LeseInt(FensterY2,4,34,15,MinFormY,FormY,TC);
  413.      14 : LeseBoolean(Spiegeln,32,18,TC);
  414.      15 : LeseBoolean(Portrait,32,19,TC);
  415.      16 : LeseBoolean(AufDatei,32,20,TC);
  416.      17 : PlotSpeed:=LeseInt(PlotSpeed,3,40,21,SpeedMin,SpeedMax,TC);
  417.      18 : InputCtrlSeq(DeviceInit,62,15,22,TC);
  418.      19 : InputCtrlSeq(DeviceExit,62,15,23,TC);
  419.     end;
  420.    Until Menueende(L,19,1,TC);
  421.    GrafWindow(FensterX1,FensterY1,FensterX2,FensterY2);
  422.   End;
  423. end;
  424.  
  425. Begin
  426.   ActualHelp:=87;
  427.   ClearForm;
  428.   WriteForm;
  429.   MainForm;
  430. End;
  431.  
  432. Procedure SetStiftBreite;
  433. Var TC  :Char;
  434.     L   :Integer;
  435. begin
  436.   ActualHelp:=56;
  437.   ClrScr;
  438.   HeadLine('Vorgabe der Stiftbreiten');
  439.   Line25;
  440.   With SetupInfo.PinstInfo do
  441.   begin
  442.     For L:= PenMin to PenMax do
  443.     begin
  444.       GotoXY(1,L+3);
  445.       LowVideo;
  446.       Write('Nummer des Stifts : ',L);
  447.       GotoXY(30,L+3);Write('Breite :             mm');
  448.       GotoXY(39,L+3);
  449.       RealStr(Stiftbreiten[L],6,OutString);
  450.       NormVideo;
  451.       Write(OutString);
  452.     end;
  453.     L:=PenMin;;
  454.     Repeat
  455.       If L<PenMin then L:=PenMin;
  456.       StiftBreiten[L]:=LeseReal(Stiftbreiten[L],6,39,L+3,0.0,2.0,TC);
  457.     Until Menueende(L,Penmax,1,TC);
  458.   end;
  459. end;
  460.  
  461.   
  462.  
  463. end.